package com.pai4j.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 群聊邀请状态枚举
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum GroupInvitationStatusEnum {

    PENDING(1, "待处理"),
    ACCEPTED(2, "已接受"),
    REJECTED(3, "已拒绝"),
    EXPIRED(4, "已过期");

    private Integer status;
    private String statusName;

    /**
     * 判断是否为待处理状态
     */
    public static boolean isPending(Integer status) {
        return PENDING.getStatus().equals(status);
    }

    /**
     * 判断是否已接受
     */
    public static boolean isAccepted(Integer status) {
        return ACCEPTED.getStatus().equals(status);
    }

    /**
     * 判断是否已拒绝
     */
    public static boolean isRejected(Integer status) {
        return REJECTED.getStatus().equals(status);
    }

    /**
     * 判断是否已过期
     */
    public static boolean isExpired(Integer status) {
        return EXPIRED.getStatus().equals(status);
    }

    /**
     * 根据状态值获取枚举
     */
    public static GroupInvitationStatusEnum getByStatus(Integer status) {
        for (GroupInvitationStatusEnum statusEnum : values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum;
            }
        }
        return null;
    }
}
